Skip to content

Conversation

@crspeller
Copy link
Contributor

When attempting to create an OAuth authentication on top of the SSE transport I discovered the sseClientConn was using http.DefaultClient for requests instead of the custom client provided via SSEClientTransportOptions.

This change stores the HTTP client in the sseClientConn struct and uses it for all requests. Also adds test to verify the custom client is properly used.

The sseClientConn was using http.DefaultClient for requests
instead of the custom client provided via SSEClientTransportOptions.
This change stores the HTTP client in the sseClientConn struct and
uses it for all requests. Also adds test to verify the custom client
is properly used.
mcp/sse_test.go Outdated
}

// roundTripperFunc is a helper to create a custom RoundTripper
type roundTripperFunc struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type roundTripperFunc func(...)

You should be able to write a method on that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! TIL

@jba
Copy link
Contributor

jba commented Jul 8, 2025

LGTM. Rob will approve.

Copy link
Contributor

@findleyr findleyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix! Once you've addressed Jonathan's comment, we can merge.

@crspeller crspeller requested review from findleyr and jba July 8, 2025 18:08
@jba jba merged commit 2b07560 into modelcontextprotocol:main Jul 9, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants